package com.kanshu.ksgb.fastread.doudou.common.business.ad.retrofit;

import com.kanshu.ksgb.fastread.doudou.R;
import com.kanshu.ksgb.fastread.doudou.app.Xutils;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by daniel on 17-12-13.
 */

public class ADConfigBean {
    public String id;
    //广告类型，1sdk广告(美生源)，2api广告，3图文广告，4sdk广告(广点通),5sdk广告(360),6sdk广告(inmobi),7sdk广告(adHub),8sdk广告(道有道)，9.今日头条，10，洛米
    public String ad_type;
    /*广告位位置名称,1启动页，2精选插屏，3充值页通栏，4书架收藏，5精选通栏，6阅读页悬浮，7书架上方banner，
       8精选页面下方固定banner，9详情页面下方固定banner，10每章衔接之间广告 ,13 章节衔接之间的广告(为章节倍数_5)*/
    public String ad_position;
    //是否关闭，1关闭，0打开
    public String is_close;
    public String app_id;
    public String title;
    public String creator;
    public String editor;
    public String createtime;
    public String edittime;
    public String channel_id;
    public String app_name;
    public String app_type;
    public String ad_image_url;
    public String ad_image_jump;
    public String ad_position_id;
    public String second_ad_type;
    public String second_ad_position_id;
    public String description;
    public String third_ad_type;
    public String third_ad_position_id;
    // 1 跳转微信 0 不跳转
    public String is_jump_wx_client;
    public List<AdType> ad_type_lists;

    public static final int TYPE_MSY = 1;
    public static final int TYPE_API = 2;
    // 自己的广告
    public static final int TYPE_OWN = 3;
    // 广点通广告
    public static final int TYPE_GDT = 4;
    // 360广告
    public static final int TYPE_360 = 5;
    // inmobi
    public static final int TYPE_INMOBI = 6;
    // adhub
    public static final int TYPE_ADHUB = 7;
    // 道有道
    public static final int TYPE_DAOYOUDAO = 8;
    //今日头条
    public static final int TYPE_TODAYNEWS = 9;
    //洛米
    public static final int TYPE_LUOMI = 10;

    // 启动页广告
    public static final int POSITION_SPLASH = 1;
    // 书架上方Banner SJ-0
    public static final int POSITION_SHELF_TOP_BANNER_SJ_0 = 2;
    // 书架-编辑好书广告位SJ-1（原生封面）
    public static final int POSITION_BIANJIHAOSHU_SJ_1 = 3;
    // 书架-编辑好书广告位SJ-2（原生封面）
    public static final int POSITION_BIANJIHAOSHU_SJ_2 = 4;
    // 书架-编辑好书广告位SJ-3（原生封面）
    public static final int POSITION_BIANJIHAOSHU_SJ_3 = 5;
    // 精选-精选好书下方广告JX-1（原生上文下大图）
    public static final int POSITION_JINGXUANHAOSHU_BOTTOM_JX_1 = 6;
    // 精选-终极诱惑广告JX-2(原生封面）
    public static final int POSITION_ZHONGJIYOUHUO_JX_2 = 7;
    // 精选-终极诱惑广告JX-3（原生封面）
    public static final int POSITION_ZHONGJIYOUHUO_JX_3 = 8;
    // 精选-终极诱惑广告JX-4（原生封面）
    public static final int POSITION_ZHONGJIYOUHUO_JX_4 = 9;
    // 精选-本周强广告JX-5（原生封面）
    public static final int POSITION_BENZHOUQIANGGUANGGAO_JX_5 = 10;
    // 精选-全站畅读下方广告JX-6（原生上文下大图）
    public static final int POSITION_QUANZHANCHANGDU_BOTTOM_JX_6 = 11;
    // 精选-新书抢先广告JX-7（原生封面）
    public static final int POSITION_XINSHUQIANGXIANGUANGGAO_JX_7 = 12;
    // 精选-新书抢先广告JX-8（原生封面）
    public static final int POSITION_XINSHUQIANGXIANGUANGGAO_JX_8 = 13;
    // 男频-本周热搜MP-1（原生封面）
    public static final int POSITION_MALE_BENZHOURESOU_MP_1 = 14;
    // 男频-本周热搜MP-2（原生封面）
    public static final int POSITION_MALE_BENZHOURESOU_MP_2 = 15;
    // 男频-完结精品下方广告MP-3（原生上文下大图）
    public static final int POSITION_MALE_WANJIEJINGPING_BOTTOM_MP_3 = 16;
    // 男频-私人定制第一个位置MP-4（原生封面）
    public static final int POSITION_MALE_SIRENDINGZHI_MP_4 = 17;
    // 男频-都市生活下方广告MP-5（原生上文下大图）
    public static final int POSITION_MALE_DUSHISHENGHUO_BOTTOM_MP_5 = 18;
    // 男频-灵异推理第二个位置MP-6（原生封面）
    public static final int POSITION_MALE_LINGYITUILI_MP_6 = 19;
    // 女频-本周热搜NP-1（原生封面）
    public static final int POSITION_FEMALE_BENZHOURESOU_NP_1 = 20;
    // 女频-本周热搜NP-2（原生封面）
    public static final int POSITION_FEMALE_BENZHOURESOU_NP_2 = 21;
    // 女频-全本下方广告NP-3（原生上文下大图）
    public static final int POSITION_FEMALE_QUANBEN_BOTTOM_NP_3 = 22;
    // 女频-经典第一个位置NP-4（原生封面）
    public static final int POSITION_FEMALE_JINGDIAN_NP_4 = 23;
    // 女频-宫闱情仇下方广告NP-5（原生上文下大图）
    public static final int POSITION_FEMALE_GONGWEIQINGCHOU_NP_5 = 24;
    // 女频-架空历史第三个位置NP-6（原生封面）
    public static final int POSITION_FEMALE_JIAKONGLISHI_NP_6 = 25;
    // 专题下方banner ZT-0
    public static final int POSITION_TOPIC_BOTTOM_ZT_0 = 26;
    // 精选专题下方banner ZT-1
    public static final int POSITION_TOPIC_BOTTOM_ZT_1 = 27;
    // 书籍详情中间Banner SJXQ-1
    public static final int POSITION_BOOK_DETAIL_SJXQ_1 = 28;
    // 阅读页下方Banner
    public static final int POSITION_BOOK_READER_BOTTOM = 29;
    // 搜索页上方Banner
    public static final int POSITION_SEARCH_TOP = 30;
    // 阅读章节衔接页每5章节衔接（原生上文下大图）.
    public static final int POSITION_READER_BETWEEN_CHAPTER_5 = 31;
    // 阅读页内每5章底部banner
    public static final int POSITION_BOOK_READER_BOTTOM_5 = 32;
    // 阅读章节衔接广告
    public static final int POSITION_READER_BETWEEN_CHAPTER = 33;
    //充电锁屏广告
    public static final int POSITION_CHARGE_LOCK_SCREEN = 34;
    // 签到页广告（原生上文下大图）
    public static final int POSITION_SIGN_IN = 35;
    // 间隔时间闪屏广告
    public static final int POSITION_SPACE_TIME_SPLASH = 36;
    // 阅读器弹窗视频广告
    public static final int POSITION_READER_DIALOG_VIDEO = 37;
    // 摇一摇信息流广告
    public static final int POSITION_SHAKE_FEED = 38;
    // 书籍下载页底部banner广告
    public static final int POSITION_DOWNLOAD_BANNER = 39;

    private static Map<String, String> sMap;

    public static String getAdName(String adType) {
        if (sMap == null) {
            sMap = new HashMap<>();
            String[] names = Xutils.getContext().getResources().getStringArray(R.array.ad_name);
            for (String name : names) {
                String[] s1 = name.split(",");
                if (s1.length >= 2) {
                    sMap.put(s1[0], s1[1]);
                }
            }
        }
        return sMap.get(adType);
    }

    @Override
    public String toString() {
        return "ADConfigBean{" +
                "id='" + id + '\'' +
                ", ad_type='" + ad_type + '\'' +
                ", ad_position='" + ad_position + '\'' +
                ", is_close='" + is_close + '\'' +
                ", app_id='" + app_id + '\'' +
                ", title='" + title + '\'' +
                ", creator='" + creator + '\'' +
                ", editor='" + editor + '\'' +
                ", createtime='" + createtime + '\'' +
                ", edittime='" + edittime + '\'' +
                ", channel_id='" + channel_id + '\'' +
                ", app_name='" + app_name + '\'' +
                ", app_type='" + app_type + '\'' +
                ", ad_image_url='" + ad_image_url + '\'' +
                ", ad_image_jump='" + ad_image_jump + '\'' +
                ", ad_position_id='" + ad_position_id + '\'' +
                ", second_ad_type='" + second_ad_type + '\'' +
                ", second_ad_position_id='" + second_ad_position_id + '\'' +
                ", description='" + description + '\'' +
                ", is_jump_wx_client='" + is_jump_wx_client + '\'' +
                ", ad_type_lists=" + ad_type_lists +
                '}';
    }
}

